/**
 * 
 */
package com.antilia.infomaresme.pages.myitems;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;

import com.antilia.infomaresme.data.dataobjects.Item;
import com.antilia.infomaresme.link.JQIcon;
import com.antilia.infomaresme.link.JqAjaxLink;

/**
 * @author Ernesto
 *
 */
public abstract class DetailsLinksPanel extends Panel {

	private static final long serialVersionUID = 1L;

	/**
	 * @param id
	 * @param model
	 */
	public DetailsLinksPanel(String id, final IModel<Item> model) {
		super(id, model);
		JqAjaxLink link = new JqAjaxLink("details", JQIcon.ui_icon_zoomin, new ResourceModel("actions.view")) {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				DetailsLinksPanel.this.onSee(target, model);				
			}
		};
		add(link);
		
		JqAjaxLink edit = new JqAjaxLink("edit",JQIcon.ui_icon_document_b, new ResourceModel("actions.edit")) {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				DetailsLinksPanel.this.onEdit(target, model);
			}
		};		
		add(edit);
		
		JqAjaxLink news = new JqAjaxLink("news",JQIcon.ui_icon_comment, new ResourceModel("actions.editNews")) {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				DetailsLinksPanel.this.onSeeNews(target, model);
			}
		};
		
		add(news);
		
	}

	public abstract void onSee(AjaxRequestTarget target, IModel<Item> model);
	
	public abstract void onEdit(AjaxRequestTarget target, IModel<Item> model);
	
	public abstract void onSeeNews(AjaxRequestTarget target, IModel<Item> model);
	
}
